import {Message} from "element-ui";

export let elMessageComponent: any;
export const errorMsg = (message: any = "操作失败", errorTime = 2000) => {
    if (elMessageComponent) elMessageComponent.close();
    elMessageComponent = Message({
        message: message,
        type: 'error',
        duration: errorTime
    });
};
export const successMsg = (message: any = "操作成功", successMsgTime = 2000) => {
    if (elMessageComponent) elMessageComponent.close();

    elMessageComponent = Message({
        message: message,
        type: 'success',
        duration: successMsgTime
    });
};

export const infoMsg = (message: any = "操作成功", successMsgTime = 2000) => {
    if (elMessageComponent) elMessageComponent.close();
    elMessageComponent = Message({
        message: message,
        type: 'info',
        duration: successMsgTime
    });
};
export const warningMsg = (message: any = "操作成功", warningTime = 2000) => {
    if (elMessageComponent) elMessageComponent.close();

    elMessageComponent = Message({
        message: message,
        type: 'warning',
        duration: warningTime
    });
};



